Convert a List to a TupleΒΆ
Convert a List to a Tuple.
# create list
L = [5, 10, 7, 4, 15, 3]
print(L) # [5, 10, 7, 4, 15, 3]
# use the tuple() function built-in Python, passing as parameter the List
T = tuple(L)
print(T) # (5, 10, 7, 4, 15, 3)